-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ROCm] Implement hermetic rocm dependency #19649
base: main
Are you sure you want to change the base?
[ROCm] Implement hermetic rocm dependency #19649
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This is really exciting. Thank you. I won't be able to have a look before next week though. |
3002fbc
to
c4672b6
Compare
"6.2.0": { | ||
"archives": [ | ||
struct( | ||
url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/c/comgr6.2.0/comgr6.2.0_2.8.0.60200-66~20.04_amd64.deb", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚓
365d58e
to
772c94a
Compare
772c94a
to
cf744ec
Compare
package(default_visibility = ["//visibility:public"]) | ||
package(default_visibility = ["//visibility:private"]) | ||
|
||
bool_flag( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep the same naming convention like in CUDA flags and settings?
https://github.com/openxla/xla/blob/main/third_party/tsl/third_party/gpus/cuda/BUILD.tpl#L271-L280
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this implementation hermetic -> boolean flag mean use rpath from inside the sandbox. This is needed to execute the tests without rocm installation. I think this flag is a bit different with what is in cuda. Could you suggest a proper name that would fit the convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. In this case suggest naming config_setting as noun and bool_flag - as a verb.
def _setup_rocm_distro_dir(repository_ctx): | ||
"""Sets up the rocm hermetic installation directory to be used in hermetic build""" | ||
bash_bin = get_bash_bin(repository_ctx) | ||
os = repository_ctx.os.environ.get(_OS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we identify Ubuntu version using repository_os
data?
https://bazel.build/rules/lib/builtins/repository_os.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't look like we can. repository_os.name would contain 'linux' inside. There is no version field in os. Also I guess in a future we would like to do crosscompile so to build on ubuntu 22.04 but for ubuntu 24.04 or on ubuntu for rhel and so on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case you can try repository_ctx.execute(["uname", "-a"]).stdout
. It will print smth like this:
Linux tf-temp-ubuntu-ybaturina-2024-11-25 5.15.0-1062-gcp #70~20.04.1-Ubuntu SMP Fri May 24 20:12:18 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
I think that OS
can be used for cross-compile build, but for the regular one the repository rule should be able to identify the OS name and version.
This is not mandatory though, just an option.
@@ -888,6 +874,8 @@ _ENVIRONS = [ | |||
"TF_NEED_CUDA", # Needed by the `if_gpu_is_configured` macro | |||
_ROCM_TOOLKIT_PATH, | |||
_TF_ROCM_AMDGPU_TARGETS, | |||
_OS, | |||
_ROCM_VERSION, | |||
] | |||
|
|||
remote_rocm_configure = repository_rule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to remove it from here and from
remote_rocm_configure( |
The reason is that by implementing hermetic ROCM repo rules, you provide the ROCM data to Bazel cache on all machines, including RBE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 modes in rocm build right now. The first one is like it was originally. We use the local rocm installation and just link the directory of it to our sandbox. The second one is the hermetic build where we bring the files from our deb repo. If we remove that remote_rocm_configure then we shall be sure that remote execution is using hermetic build. Shall it be done in this PR or better create a follow-up pr that would do exactly that thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Yes, I agree that it can be addressed in a separate PR.
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:hermetic=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 8e164f7 PiperOrigin-RevId: 705123256
Imported from GitHub PR openxla/xla#19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:hermetic=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: openxla/xla#19691 Copybara import of the project: -- cf744eca78f697144e122c6a9d1aa8fc52722b20 by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad859ec3143fdb04f7792541c61b98c708397 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f765b45b5e5d118b02695fd6d6e2b0b232d by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 8e164f765b45b5e5d118b02695fd6d6e2b0b232d PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 35538f4 PiperOrigin-RevId: 705123256
Imported from GitHub PR openxla/xla#19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: openxla/xla#19691 Copybara import of the project: -- cf744eca78f697144e122c6a9d1aa8fc52722b20 by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad859ec3143fdb04f7792541c61b98c708397 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f765b45b5e5d118b02695fd6d6e2b0b232d by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4922b5b28b9debd0ce17bb15b83b5921fc by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 35538f4922b5b28b9debd0ce17bb15b83b5921fc PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 35538f4 PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 35538f4 PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath -- 58d1402 by Alexandros Theodoridis <[email protected]>: Fix build for cuda and cpu Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 58d1402 PiperOrigin-RevId: 705123256
Imported from GitHub PR openxla/xla#19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: openxla/xla#19691 Copybara import of the project: -- cf744eca78f697144e122c6a9d1aa8fc52722b20 by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad859ec3143fdb04f7792541c61b98c708397 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f765b45b5e5d118b02695fd6d6e2b0b232d by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4922b5b28b9debd0ce17bb15b83b5921fc by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath -- 58d140220e9e58572c9a7ae3de2ec1ea189566d3 by Alexandros Theodoridis <[email protected]>: Fix build for cuda and cpu Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 58d140220e9e58572c9a7ae3de2ec1ea189566d3 PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath -- 58d1402 by Alexandros Theodoridis <[email protected]>: Fix build for cuda and cpu Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 58d1402 PiperOrigin-RevId: 705123256
Imported from GitHub PR #19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: #19691 Copybara import of the project: -- cf744ec by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad85 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f7 by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4 by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath -- 58d1402 by Alexandros Theodoridis <[email protected]>: Fix build for cuda and cpu Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 58d1402 PiperOrigin-RevId: 705123256
Imported from GitHub PR openxla/xla#19649 This change has as a goal to introduce an external dependency to the rocm library and tools. Building xla with the hermetic rocm is done by using these env variables: --repo_env=OS=ubuntu_20.04 --repo_env=ROCM_VERSION=6.2.0 To use only hermetic libs define this flag: --@local_config_rocm//rocm:use_rocm_hermetic_rpath=True This flag will make rpaths and configs to look inside the sandbox If flag is not set then default installation paths are used e.g /opt/rocm One has to provie OS version and ROCm version to initialize a proper rocm repository. If these flags are not set then default ROCm installation will be used to build XLA. depends-on: openxla/xla#19691 Copybara import of the project: -- cf744eca78f697144e122c6a9d1aa8fc52722b20 by Alexandros Theodoridis <[email protected]>: Implement hermetic rocm dependency -- 4f4ad859ec3143fdb04f7792541c61b98c708397 by Alexandros Theodoridis <[email protected]>: Add missing dependency -- 8e164f765b45b5e5d118b02695fd6d6e2b0b232d by Alexandros Theodoridis <[email protected]>: Add missing dependency and remove so files from data -- 35538f4922b5b28b9debd0ce17bb15b83b5921fc by Alexandros Theodoridis <[email protected]>: Rename setting to use_rocm_hermetic_rpath -- 58d140220e9e58572c9a7ae3de2ec1ea189566d3 by Alexandros Theodoridis <[email protected]>: Fix build for cuda and cpu Merging this change closes #19649 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#19649 from ROCm:ci_implement_hermetic_rocm_dependency_upstream 58d140220e9e58572c9a7ae3de2ec1ea189566d3 PiperOrigin-RevId: 705123256
This change has as a goal to introduce an external dependency to the rocm library and tools.
Building xla with the hermetic rocm is done by using these env variables:
--repo_env=OS=ubuntu_20.04
--repo_env=ROCM_VERSION=6.2.0
To use only hermetic libs define this flag:
--@local_config_rocm//rocm:use_rocm_hermetic_rpath=True
This flag will make rpaths and configs to look inside the sandbox
If flag is not set then default installation paths are used e.g /opt/rocm
One has to provie OS version and ROCm version to initialize a proper rocm repository.
If these flags are not set then default ROCm installation will be used to build XLA.
depends-on: #19691